package com.tonyodev.fetch2;

import com.tonyodev.fetch2core.Extras;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
 * Class used to enqueue an already completed download into Fetch for management
 *
 * @since 2021-06-17
 */
public class CompletedDownload {
    @NotNull
    private String url = "";
    @NotNull
    private String file = "";
    private int group;
    private long fileByteSize;
    @NotNull
    private Map headers = Collections.emptyMap();
    @Nullable
    private String tag;
    private long identifier;
    private long created;
    @NotNull
    private Extras extras;

    @NotNull
    public final String getUrl() {
        return this.url;
    }

    public final void setUrl(@NotNull String var1) {
        this.url = var1;
    }

    @NotNull
    public final String getFile() {
        return this.file;
    }

    public final void setFile(@NotNull String var1) {
        this.file = var1;
    }

    public final int getGroup() {
        return this.group;
    }

    public final void setGroup(int var1) {
        this.group = var1;
    }

    public final long getFileByteSize() {
        return this.fileByteSize;
    }

    public final void setFileByteSize(long var1) {
        this.fileByteSize = var1;
    }

    @NotNull
    public final Map getHeaders() {
        return this.headers;
    }

    public final void setHeaders(@NotNull Map var1) {
        this.headers = var1;
    }

    @Nullable
    public final String getTag() {
        return this.tag;
    }

    public final void setTag(@Nullable String var1) {
        this.tag = var1;
    }

    public final long getIdentifier() {
        return this.identifier;
    }

    public final void setIdentifier(long var1) {
        this.identifier = var1;
    }

    public final long getCreated() {
        return this.created;
    }

    public final void setCreated(long var1) {
        this.created = var1;
    }

    public final Extras getExtras() {
        return this.extras;
    }

    public final void setExtras(@NotNull Extras var1) {
        this.extras = var1;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CompletedDownload that = (CompletedDownload) o;
        return group == that.group &&
            fileByteSize == that.fileByteSize &&
            identifier == that.identifier &&
            created == that.created &&
            url.equals(that.url) &&
            file.equals(that.file) &&
            headers.equals(that.headers) &&
            Objects.equals(tag, that.tag) &&
            extras.equals(that.extras);
    }

    @Override
    public int hashCode() {
        return Objects.hash(url, file, group, fileByteSize, headers, tag, identifier, created, extras);
    }
}
